package huawei.nktest1;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] data = new int[n][3];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                data[i][j] = sc.nextInt();
            }
        }
        long[][] dp = new long[n][3];
        dp[0][0] = data[0][0];
        dp[0][1] = data[0][1];
        dp[0][2] = data[0][2];
        for (int i = 1; i < dp.length; i++) {
            dp[i][0] = Math.min(dp[i - 1][1], dp[i - 1][2]) + data[i][0];
            dp[i][1] = Math.min(dp[i - 1][0], dp[i - 1][2]) + data[i][1];
            dp[i][2] = Math.min(dp[i - 1][0], dp[i - 1][1]) + data[i][2];
        }
        long min = dp[n - 1][0];
        for (int i = 1; i < 3; i++) {
            min = Math.min(min, dp[n - 1][i]);
        }
        System.out.println(min);
    }
    static void   fun2(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] data = new int[n][3];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                data[i][j] = sc.nextInt();
            }
        }
        int res = dfs(data,0,0,-1);
        System.out.println(res);
    }
    private static int dfs(int[][] data, int index, int tmp,int lastChoose) {
        if(index==data.length){
            return tmp;
        }
        int minIndex=-1;
        int min =Integer.MAX_VALUE;
        for (int i = 2; i >= 0; i--) {
            if(lastChoose==i){
                continue;
            }
            if(data[index][i]<min){
                min=data[index][i];
                minIndex=i;
            }
        }
        return dfs(data,index+1,tmp+min,minIndex);
    }

}
